package com.kehao.leetcode.jzoffer;

import org.junit.Test;

/**
 * @author Kehao.Chen
 * @version 1.0
 * @date 2022/6/8 14:42
 */
public class JZSolution004 {
    public int singleNumber(int[] nums) {
        int sum = 0;
        for (int i = 0; i < 32; i++) {
            int total = 0;
            for (int num : nums) {
                total += (num >> i) & 1;
            }
            sum += (total%3)<<i;
        }
        return sum;
    }

    @Test
    public void test01(){
        int[] nums = {0,1,0,1,0,1,100};
        System.out.println(singleNumber(nums));
    }
}
